package co.yixiang.huiMin.service.impl;

import co.yixiang.huiMin.entity.YxStoreOrder;
import co.yixiang.huiMin.mapper.YxStoreOrderMapper;
import co.yixiang.huiMin.service.YxStoreOrderService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 订单表 服务实现类
 * </p>
 *
 * @author Author
 * @since 2020-07-04
 */
@Service
public class YxStoreMybatisOrderServiceImpl extends ServiceImpl<YxStoreOrderMapper, YxStoreOrder> implements YxStoreOrderService {

    @Resource
    private YxStoreOrderMapper yxStoreOrderMapper;

    @Override
    public void inquiryOrderInfo() {

    }

    @Override
    public Map<String, Object> selectMassages(String merId) {

        Map<String,Object> map = new HashMap<>();
        //今日订单
        List<YxStoreOrder> todayList=yxStoreOrderMapper.selectMassageTodayList(merId);
        map.put("todayList",todayList.size());
        //今日金额
        map.put("todayMoney",yxStoreOrderMapper.selectMassageTodayMoney(merId));
        //本月订单
        List<YxStoreOrder> MonthList=yxStoreOrderMapper.selectMassageMonthList(merId);
        map.put("MonthList",MonthList.size());
        //本月金额
        map.put("MonthMoney",yxStoreOrderMapper.selectMassageMonthMoney(merId));
        return map;
    }

    @Override
    public List<YxStoreOrder> selectYxStoreOrders(String merId) {
        QueryWrapper<YxStoreOrder> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("mer_id",merId);
        return yxStoreOrderMapper.selectList(queryWrapper);
    }
}
